package org.saxonextensions.eml.dispatcher.jboss;

import org.jboss.mx.util.ObjectNameFactory;

import javax.management.ObjectName;

/**
 * EML Dispatcher Service MBean interface
 */
public interface EMLDispatcherServiceMBean extends org.jboss.system.ServiceMBean {

  /** Object Name */
  public static final ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss:type=Service,service=EMLDispatcher");

  /**
   * Set a JNDI Name to bind this service to
   *
   * @param name JNDI name
   */
  void setJndiName(String name);

  /**
   * Return a JNDI name this service is bound to
   *
   * @return JNDI name
   */
  public String getJndiName();

  /**
   * Return mail service JNDI name
   *
   * @return JBoss mail service JNDI name
   */
  public String getMailServiceJndiName();

  /**
   * Set mail service JNDI name
   *
   * @param mailServiceJndiName JBoss mail service JNDI name
   */
  public void setMailServiceJndiName(String mailServiceJndiName);

  /**
   * Return max thread count for this dispatcher
   * @return max thread count
   */
  public int getMaxThreads();

  /**
   * Set max thread count for this dispatcher
   *
   * @param maxThreads max thread count
   */
  public void setMaxThreads(int maxThreads);

  /**
   * Return a number of busy threads
   *
   * @return number of busy threads
   */
  public int getBusyThreads();

  /**
   * Send a test eMail to given email address
   *
   * @param mailto email address
   * @throws Exception when unable to send a test email
   */
  public void sendTestEmail(String mailto) throws Exception;

  /**
   * Return debug flag
   *
   * @return debug flag
   */
  public boolean getDebug();

  /**
   * Set debug flag
   * 
   * @param debug debug flag
   */
  public void setDebug(boolean debug);

}
